import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int i1 = sc.nextInt();
        if (i1==0){
            System.out.println(0);
        }else {
            System.out.println(sum_66(i1));
        }
    }
    public static int sum_66(int n){
        if (n==1){
            return 6;
        }else {
            return sum_66(n-1)+sum_pow(n);
        }
    }
    public static int sum_pow(int n){
        int sum=0;
        for (int i=0;i<n;i++){
            sum+=6*Math.pow(10,i);
        }
        return sum;
    }
}
